package com.cssl.controller;

import cn.hutool.core.util.ObjectUtil;
import com.cssl.domain.dto.DtsCollectDto;
import com.cssl.domain.dto.DtsFootprintDto;
import com.cssl.service.DtsCollectService;
import com.cssl.service.DtsFootprintService;
import com.cssl.util.InfoCode;
import com.cssl.util.Result;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/userfootprint")
@Api(value = "浏览足迹接口",tags = "浏览相关操作")
public class DtsFootprintController {

    @Autowired
    private DtsFootprintService dtsFootprintService;

    @PostMapping("/listFootprint")
    public Result getDtsFootprintList(@RequestBody DtsFootprintDto dtsFootprintDto) {
        Map footprintList = dtsFootprintService.getFootprintList(dtsFootprintDto);
        if (ObjectUtil.isEmpty(footprintList.get("list"))) {
            return Result.result(InfoCode.QUERY_EMPTY, InfoCode.MESSAGE_QUERY_EMPTY, null, System.currentTimeMillis());
        }
        return Result.result(InfoCode.OK, InfoCode.MESSAGE_OK, footprintList, System.currentTimeMillis());

    }
}
